export default{
    setHeaderTitle(state,routername){
        switch(routername){
            case 'day':
                state.headerTitle='今日信息'
                break
            case 'month':
                state.headerTitle='近期假期'
                break
            case 'year':
                state.headerTitle='当年假期'
                break
            default:
                state.headerTitle='今日信息'
                break
        }
    },
    setplaceholder(state,routername){
        
            const date=new Date()
            const year=date.getFullYear()
            const month=(date.getMonth()+1).toString().padStart(2,'0')
            const day=date.getDay().toString().padStart(2,'0')
switch(routername){
            case 'day':
                state.placeholder=`格式：${year}${month}${day}(${year}年${month}月${day}日)`
                break
            case 'month':
                state.placeholder=`格式：${year}${month}(${year}年${month}月)`
                break
            case 'year':
               state.placeholder=`格式：${year}(${year}年)`
                break
            default:
                state.placeholder=`格式：${year}${month}${day}(${year}年${month}月${day}日)`
                break
    }},
    setmaxlength(state,routername){
        switch(routername){
            case 'day':
                state.maxlength=8
                break
            case 'month':
                state.maxlength=6
                break
            case 'year':
                state.maxlength=4
                break
            default:
                state.maxlength=8
                break
        }
    },
    setfield(state,routername){
        state.field=routername
    },
    seterrorCode(state,error){
       state.errorCode=error
    },
    setData(state,payload){
        const{field,data}=payload
        switch(field){
        case 'day':
            state.dayData=data
            console.log(state.dayDate)
            break
        case 'month':
            state.monthData=data
            break
        case 'year':
             state.yearDate=data
                break
            }
           
}
}